//
//  SRModifyPersonalHeightView.m
//  SportRing
//
//  Created by icelee on 14-10-31.
//  Copyright (c) 2014年 HotOne. All rights reserved.
//

#import "SRModifyPersonalHeightView.h"
#import "SRDB.h"

@interface SRModifyPersonalHeightView()


@property(nonatomic, weak)IBOutlet UILabel *showHeightLabel;


@end

@implementation SRModifyPersonalHeightView

- (void)awakeFromNib
{
    [super awakeFromNib];
    
   }

- (void)setWeightLabelValue:(NSInteger)value
{
    [_showHeightLabel setText:[NSString stringWithFormat:@"%ldcm",(long)value]];
}

- (void)setCurrentHeight:(NSInteger)currentHeight
{
    [self setWeightLabelValue:currentHeight];
    
    if (_currentHeight == currentHeight) {
        return;
    }
    _currentHeight = currentHeight;
    
  
}

+ (SRModifyPersonalHeightView*)LoadSRModifyPersonalHeightView
{
    NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SRModifyPersonalHeightView" owner:self options:nil];
    
    return [nib objectAtIndex:0];
}

-(void)currentValue:(NSInteger)value
{
    _currentHeight = value;
    
    [self setWeightLabelValue:value];
    
}

- (void)didSelectValue:(NSInteger)value
{
    _currentHeight = value;
    [[SRMe currentUser] configAttributesWithBlock:^(SRMe *meSelf) {
        meSelf.height = @(_currentHeight);
    }];
    
    [self setWeightLabelValue:value];
}

@end
